package com.aaa.pr.controller;

import com.aaa.common.entity.Book;
import com.aaa.common.entity.Product;
import com.aaa.pr.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (Product)表控制层
 *
 * @author makejava
 * @since 2020-07-24 15:03:12
 */
@RestController
@RequestMapping("product")
public class ProductController {
    /**
     * 服务对象
     */
    @Autowired
    private ProductService productService;

    @GetMapping("selectAll")
    public Map selectAll() {
        Map map=new HashMap();
        List<Product> products = productService.selectAll();
        List<Book> books = productService.selectBook();
        map.put("products",products);
        map.put("books",books);
        return map;
    }

}